package repository

import (
	"context"
	"github.com/aphasia51/website/internal/domain"
	"github.com/aphasia51/website/internal/repository/dao"
)

type WasteChemicalRepository struct {
	dao *dao.WasteChemicalDAO
}

func NewWasteChemicalRepository(dao *dao.WasteChemicalDAO) *WasteChemicalRepository {
	return &WasteChemicalRepository{
		dao: dao,
	}
}

func (r *WasteChemicalRepository) Query(ctx context.Context, a domain.WasteChemical) (domain.WasteChemical, error) {
	WasteChemical, err := r.dao.Query(ctx, dao.WasteChemical{
		Year: a.Year,
	})

	if err != nil {
		return domain.WasteChemical{}, err
	}

	return domain.WasteChemical{
		Year: WasteChemical.Year,
	}, nil
}
